
package net.minecraft.src;


public class ItemBlockSticky extends Item{
			private int blockID;
	        public ItemBlockSticky(int i, Block block) {
	                super(i);
	                setHasSubtypes(true);
	                blockID = i;
	        }

	        public int getMetadata(int par1)
	        {
	        	return par1;
	        }
	        public int getPlacedBlockMetadata(int i) {
	                return i;
	        }
	        public int getIconFromDamage(int par1)
	        {

				switch( par1 )
				{
				case  mod_BlockSticky.brickStickyId:
					return mod_BlockSticky.itemBricksStickyTexture;
				case  mod_BlockSticky.stoneStickyId:
					return mod_BlockSticky.itemstoneStickyTexture;
				case  mod_BlockSticky.glassStickyId:
					return mod_BlockSticky.itemGlassStickyTexture;
				case  mod_BlockSticky.stoneBrickStickyId:
					return mod_BlockSticky.itemStoneBrickStickyTexture;					
				case  mod_BlockSticky.cobleStoneStickyId:
					return mod_BlockSticky.itemCobleStoneStickyTexture;
				case  mod_BlockSticky.planksStickyId:
					return mod_BlockSticky.itemPlanksStickyTexture;
				case  mod_BlockSticky.stoneConductiveStickyIdActive:
					return mod_BlockSticky.itemConductiveStickyTexture;
				case  mod_BlockSticky.stoneConductiveStickyIdIdle:
					return mod_BlockSticky.itemConductiveStickyTexture;
				}
	            return mod_BlockSticky.itemstoneStickyTexture;
	        }
	        public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
	        {
	            int i = par3World.getBlockId(par4, par5, par6);

	            if (i == Block.snow.blockID)
	            {
	                par7 = 1;
	            }
	            else if (i != Block.vine.blockID && i != Block.tallGrass.blockID && i != Block.deadBush.blockID)
	            {
	                if (par7 == 0)
	                {
	                    par5--;
	                }

	                if (par7 == 1)
	                {
	                    par5++;
	                }

	                if (par7 == 2)
	                {
	                    par6--;
	                }

	                if (par7 == 3)
	                {
	                    par6++;
	                }

	                if (par7 == 4)
	                {
	                    par4--;
	                }

	                if (par7 == 5)
	                {
	                    par4++;
	                }
	            }

	            if (par1ItemStack.stackSize == 0)
	            {
	                return false;
	            }

	            if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
	            {
	                return false;
	            }

	            if (par5 == 255 && Block.blocksList[blockID].blockMaterial.isSolid())
	            {
	                return false;
	            }

	            if (par3World.canBlockBePlacedAt(blockID, par4, par5, par6, false, par7))
	            {
	                Block block = Block.blocksList[blockID];

	                if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, blockID, getMetadata(par1ItemStack.getItemDamage())))
	                {
	                    if (par3World.getBlockId(par4, par5, par6) == blockID)
	                    {
	                        Block.blocksList[blockID].onBlockPlaced(par3World, par4, par5, par6, par7);
	                        Block.blocksList[blockID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer);
	                    }

	                    par3World.playSoundEffect((float)par4 + 0.5F, (float)par5 + 0.5F, (float)par6 + 0.5F, block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
	                    par1ItemStack.stackSize--;
	                }

	                return true;
	            }
	            else
	            {
	                return false;
	            }
	        }
	        public String getItemNameIS(ItemStack par1ItemStack)
	        {
	        	String  name = new String();
				switch( par1ItemStack.getItemDamage() )
				{
				case  mod_BlockSticky.brickStickyId:
					name = mod_BlockSticky.brickStickyName;
					break;
				case  mod_BlockSticky.stoneStickyId:
					name = mod_BlockSticky.stoneStickyName;
					break;
				case  mod_BlockSticky.glassStickyId:
					name = mod_BlockSticky.glassStickyName;
					break;
				case  mod_BlockSticky.stoneBrickStickyId:
					name = mod_BlockSticky.stoneBrickStickyName;					
					break;
				case  mod_BlockSticky.cobleStoneStickyId:
					name = mod_BlockSticky.coblestoneStickyName;
					break;
				case  mod_BlockSticky.planksStickyId:
					name = mod_BlockSticky.planksStickyName;
					break;
				case  mod_BlockSticky.stoneConductiveStickyIdActive:
						name = mod_BlockSticky.stoneConductiveStickyName;
						break;
				case  mod_BlockSticky.stoneConductiveStickyIdIdle:
						name = mod_BlockSticky.stoneConductiveStickyName;
						break;
				}
				return  getItemName() + "." + name;
			}
	}